﻿Partial Public Class WebForm_ManageProgramData
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            '判斷是否有找到
            If DirectCast(Master.FindControl("lblHeadText"), Label) IsNot Nothing Then
                DirectCast(Master.FindControl("lblHeadText"), Label).Text = Me.GetLocalResourceObject("Page.Text")
            End If
        End If
    End Sub

    Protected Sub gvOut_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim key As DataKey = gvOut.DataKeys(e.Row.RowIndex)
            If key.Item("Parent") = 0 Then
                Dim lblText As Label = e.Row.FindControl("lblText")
                If Not lblText Is Nothing Then
                    lblText.ForeColor = Drawing.Color.Green
                    lblText.Font.Bold = True
                End If
            End If

            If gvOut.DataKeys(e.Row.RowIndex)("Parent").ToString() = "0" Then
                Dim ddlMenuName As DropDownList = e.Row.FindControl("ddlMenuName")
                If ddlMenuName IsNot Nothing Then
                    ddlMenuName.Visible = False
                End If
                Dim lblMenuName As Label = e.Row.FindControl("lblMenuName")
                If lblMenuName IsNot Nothing Then
                    lblMenuName.Visible = False
                End If
            End If
        End If
    End Sub

    Protected Sub gv_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim key As DataKey = gv.DataKeys(e.Row.RowIndex)
            If key.Item("Parent") = 0 Then
                Dim lblText As Label = e.Row.FindControl("lblText")
                If Not lblText Is Nothing Then
                    lblText.ForeColor = Drawing.Color.Green
                    lblText.Font.Bold = True
                End If
            End If

            If gv.DataKeys(e.Row.RowIndex)("Parent").ToString() = "0" Then
                Dim ddlMenuName As DropDownList = e.Row.FindControl("ddlMenuName")
                If ddlMenuName IsNot Nothing Then
                    ddlMenuName.Visible = False
                End If
                Dim lblMenuName As Label = e.Row.FindControl("lblMenuName")
                If lblMenuName IsNot Nothing Then
                    lblMenuName.Visible = False
                End If
            End If
        End If
    End Sub
End Class
